/**
 * Created by wangxiaoqiang on 2017/9/15.
 */
//添加商品分类
let addCategory = (data)=>{
    $.post(rootPath+"/category",data,(res)=> {
        if(res.meta.code === 200){
            alert("添加成功")
        }else {
            alert("添加失败--"+res.meta.code)
        }
    })
};

let c_info = new NiceValidate([
    {dom:document.querySelector("#name")},
    {dom:document.querySelector("#parentPid")},
    {dom:document.querySelector("#c_desc")},
]);

$("#submit").click(function () {
    if(c_info.niceValidate()){
        addCategory(c_info.niceValidate())
    }else {
        alert("请检查您填写的信息")
    }
});